﻿<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <title>密码找回</title>

</head>
<body>
    <link rel="stylesheet" href="/Content/layuimini/lib/layui-v2.5.5/css/font_24081_qs69ykjbea.css" />
    <link rel="stylesheet" href="/Content/layuimini/lib/layui-v2.5.5/css/layui.css" />
    <link rel="stylesheet" href="/Content/layuimini/lib/layui-v2.5.5/css/globel.css" />

    <div class="layui-header header header-undefined" style="background-color: #24262F;">
        <div class="layui-container">
            <a class="logo" href=""> <img src="/Content/logo.png" alt="layui" style="display: inline-block; height: 60px;vertical-align: middle;" /> </a>
            <div class="layui-form component" lay-filter="LAY-site-header-component"></div>

        </div>
    </div>

    <div class="layui-container fly-marginTop" style="width:750px !important;">
        <div class="fly-panel fly-panel-user" pad20="">
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title">
                    <li class="layui-this">密码找回</li>
                </ul>
                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                    <div id="resetform" class="layui-tab-item layui-show">
                        <div class="layui-form layui-form-pane">

                            <div class="layui-form-item" style="display:none;">
                                <input type="hidden" name="secret" value="" />
                                <label for="L_email" class="layui-form-label">手机/邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_loginName" name="loginName" required="" lay-verify="required" autocomplete="off" class="layui-input" value="@ViewBag.LoginName" />
                                </div>
                                <div class="layui-form-mid layui-word-aux">

                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass" name="pass" required="" lay-verify="required" autocomplete="off" class="layui-input" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密码确认</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass_again" name="pass_again" required="" lay-verify="required" autocomplete="off" class="layui-input" />
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <button class="layui-btn" lay-filter="*" id="btnOK">确认修改</button>
                            </div>
                            <div class="layui-form-item fly-form-app" id="resetsucceed" style="display:none;">
                                <a href="/Login/Index">返回主页登录</a>
                            </div>

                        </div>
                    </div>
                    <div id="linkunavaliable" style="display:none;">
                        该连接无效或已经过时，请转<a  href="/Login/Index" style="color:dodgerblue; text-decoration:underline;">登录页面</a>重新发送忘记密码申请！<br />
                        The connection is invalid or out of date.Please go to<a href="/Login/Index" style="color:dodgerblue;text-decoration:underline;"> the login page</a> and resend the reset password application!
</div>
                </div>
            </div>
        </div>
    </div>
    <div class="fly-footer">

    </div>

    <script src="/Content/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="/content/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
    <script type="text/javascript">
           layui.use(['layer'], function () {
               var $ = layui.jquery,
             layer = layui.layer;
          

            var LoginName = '@ViewBag.LoginName';
            if (LoginName == "") {
                $("#linkunavaliable").show();
                $("#resetform").html("");
            } else {
                $("#linkunavaliable").hide();
                $("#resetform").show();
            }

            $("#btnOK").click(function () {
                var username = $("#L_loginName").val();
                var L_pass = $("#L_pass").val();
                var L_pass_again = $("#L_pass_again").val();
                if (L_pass == "" || L_pass_again == "") {
                     layer.alert("密码两次输入不一致");
                   return;
                }
                if(L_pass !=L_pass_again){
                    layer.alert("密码两次输入不一致");
                   return;
                }


                var reportUrl = "/Login/ModifyResetPassword";
                $.ajax({
                    type: "post",
                    url: reportUrl,
                    data: { L_pass: L_pass, L_pass_again: L_pass_again, username: username },
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            layer.alert("修改成功");
                            $("#resetsucceed").show();
                        }
                    }, error: function (data) {
                    }
                });


            });
        });


    </script>
</body>
</html>